<?php

Raise::load('core.RaiseObject');

/**
 * RaiseFunction class
 * Function related functionality
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.core.reflection
 * @since 1.2
 */
class RaiseFunction extends RaiseObject {
    
    /**
     * Name of the function
     * @var string
     */
    private $function;
    
    /**
     * Create a RaiseFunction object
     * @param string $function The name of the function
     */
    public function __construct($function){
        $this->function = $function;
    }
    
    /**
     * Get the name of the function
     * @return string
     */
    public function name(){
        return $this->function;
    }
    
    /**
     * Check if the function exists
     * @return boolean Return TRUE if the function exists, FALSE otherwise.
     */
    public function exist(){
        return function_exists($this->function);
    }
    
    /**
     * Call the function
     * @param mixed $a,... (optional) Arguments to be passed to the function
     * @return mixed
     */
    public function call(){
        return call_user_func_array($this->function, func_get_args());
    }
    
}